package com.ruoyi.web.controller.system;

import java.util.List;

import com.ruoyi.common.core.domain.entity.UkLoginInfo;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.service.IUkLoginInfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * UK登录证书Controller
 * 
 * @author ess
 * @date 2021-10-18
 */
@RestController
@RequestMapping("/system/ukLoginiInfo")
public class UkLoginInfoController extends BaseController
{
    @Autowired
    private IUkLoginInfoService ukLoginInfoService;

    /**
     * 查询UK登录证书列表
     */
    @PreAuthorize("@ss.hasPermi('system:ukLoginiInfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(UkLoginInfo ukLoginInfo)
    {
        startPage();
        List<UkLoginInfo> list = ukLoginInfoService.selectUkLoginInfoList(ukLoginInfo);
        return getDataTable(list);
    }

    /**
     * 导出UK登录证书列表
     */
    @PreAuthorize("@ss.hasPermi('system:ukLoginiInfo:export')")
    @Log(title = "UK登录证书", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(UkLoginInfo ukLoginInfo)
    {
        List<UkLoginInfo> list = ukLoginInfoService.selectUkLoginInfoList(ukLoginInfo);
        ExcelUtil<UkLoginInfo> util = new ExcelUtil<UkLoginInfo>(UkLoginInfo.class);
        return util.exportExcel(list, "UK登录证书数据");
    }

    /**
     * 获取UK登录证书详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:ukLoginiInfo:query')")
    @GetMapping(value = "/{personId}")
    public AjaxResult getInfo(@PathVariable("personId") String personId)
    {
        return AjaxResult.success(ukLoginInfoService.selectUkLoginInfoByPersonId(personId));
    }

    /**
     * 新增UK登录证书
     */
    @PreAuthorize("@ss.hasPermi('system:ukLoginiInfo:add')")
    @Log(title = "UK登录证书", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody UkLoginInfo ukLoginInfo)
    {
        return toAjax(ukLoginInfoService.insertUkLoginInfo(ukLoginInfo));
    }

    /**
     * 修改UK登录证书
     */
    @PreAuthorize("@ss.hasPermi('system:ukLoginiInfo:edit')")
    @Log(title = "UK登录证书", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody UkLoginInfo ukLoginInfo)
    {
        return toAjax(ukLoginInfoService.updateUkLoginInfo(ukLoginInfo));
    }

    /**
     * 删除UK登录证书
     */
    @PreAuthorize("@ss.hasPermi('system:ukLoginiInfo:remove')")
    @Log(title = "UK登录证书", businessType = BusinessType.DELETE)
	@DeleteMapping("/{personIds}")
    public AjaxResult remove(@PathVariable String[] personIds)
    {
        return toAjax(ukLoginInfoService.deleteUkLoginInfoByPersonIds(personIds));
    }
}
